package cn.woochen.functionwidget.sample.player

import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import cn.jzvd.JzvdStd
import cn.woochen.functionwidget.R
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.fragment_player.*

/**
 *视频播放演示类
 *@author woochen
 *@time 2019/4/23 15:36
 */
class PlayerFragment : Fragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                              savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.fragment_player, container, false)
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        initView()
    }

    private fun initView() {
        playerView.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4", "饺子快长大", JzvdStd.SCREEN_WINDOW_NORMAL)
        Glide.with(this).load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(playerView.thumbImageView)
    }


    companion object {
        @JvmStatic
        fun newInstance() = PlayerFragment()
    }
}
